package com.lantosec.hmrp.modules.cms.vo;

import com.lantosec.hmrp.modules.cms.entity.CmsCategory;
import com.lantosec.hmrp.core.mvc.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * <p>
 * CMS栏目管理 VO对象
 * </p>
 *
 * @author AutoCode
 * @since 2020-07-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value="CmsCategory对象", description="CMS栏目管理")
public class CmsCategoryVO extends BaseVO<CmsCategory> {
    private static final long serialVersionUID = 1L;


    public CmsCategoryVO(CmsCategory entity){
        this.categoryId = entity.getCategoryId();
        this.categoryName = entity.getCategoryName();
        this.parentId = entity.getParentId();
        this.homeFlag = entity.getHomeFlag();
        this.categoryOrder = entity.getCategoryOrder();
    }

    @Override
    public CmsCategory convertToEntity(){
        return new CmsCategory(this);
    }


    @ApiModelProperty(value = "栏目ID")
    private String categoryId;

    @ApiModelProperty(value = "栏目名称")
    private String categoryName;

    @ApiModelProperty(value = "上级栏目ID")
    private String parentId;

    @ApiModelProperty(value = "是否首页展示")
    private Integer homeFlag;

    @ApiModelProperty(value = "排序")
    private Integer categoryOrder;

    private List<CmsCategoryVO> children;

    @ApiModelProperty(value = "文章列表")
    private List<CmsArticleVO> list;
}
